package jvm;


/**
 * staticObj、instanceObj、localObj这三个变量本身（而不是它们所指向的对象）存放在哪里？
 */
public class JHSDB_TestCase {

    private static class ObjectHolder {
    }

    static class Test {
        static ObjectHolder staticObj = new ObjectHolder();
        ObjectHolder instanceObj = new ObjectHolder();

        void foo() {
            ObjectHolder localObj = new ObjectHolder();
            System.out.println("done"); // 这里设一个断点
        }
    }

    /**
     * staticObj 随着Test信息放在方法区
     * instanceObj 放在堆上
     * localObj 放在foo()方法栈帧的局部变量中
     * @param args
     */
    public static void main(String[] args) {
        Test test = new JHSDB_TestCase.Test();
        test.foo();
    }
}
